package br.com.jvet.entidade;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="tbservico")
@SequenceGenerator(name="servico_seq", sequenceName="servico_seq", allocationSize=1, initialValue=0)
public class Servico implements Serializable{
	
	private static final long serialVersionUID = -3640464009428337178L;
	private int codigo;
	@Column
	private String descServico;
		
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="servico_seq")
	public int getCodigo() {
		return codigo;
	}
	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}
	public String getDescServico() {
		return descServico;
	}
	public void setDescServico(String descServico) {
		this.descServico = descServico;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + codigo;
		result = prime * result
				+ ((descServico == null) ? 0 : descServico.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Servico other = (Servico) obj;
		if (codigo != other.codigo)
			return false;
		if (descServico == null) {
			if (other.descServico != null)
				return false;
		} else if (!descServico.equals(other.descServico))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Servico [codigo=" + codigo + ", descServico=" + descServico
				+ "]";
	}
	
	

}
